package com.zl_huang.example.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zl_huang.example.dao.IExamTestTypeDaoHibernate;
import com.zl_huang.example.model.ExamTestType;
import com.zl_huang.example.model.vo.ExamTestTypeVO;
@Service
public class ExamTestTypeServiceImpl implements IExamTestTypeService {
	@Autowired
	private IExamTestTypeDaoHibernate  examTestTypeDaoHibernate;

	@Override
	public List<ExamTestTypeVO> findAllExamTestTypet() throws Exception {
		List<ExamTestType> examTestTypeList = examTestTypeDaoHibernate.findAllExamTestTypet();
		List<ExamTestTypeVO> examTestTypeVOList = new ArrayList<ExamTestTypeVO>();
		for(ExamTestType examTestType : examTestTypeList){
			ExamTestTypeVO examTestTypeVO =	new ExamTestTypeVO();
			BeanUtils.copyProperties(examTestType, examTestTypeVO);	
			examTestTypeVOList.add(examTestTypeVO);
		}
		return examTestTypeVOList;
	}

	@Override
	public ExamTestType getExamTestTypeById(Integer id) throws Exception {		
		return examTestTypeDaoHibernate.getExamTestTypeById(id);
	}

}
